Add Vitest tests for Everything Server#3236
Open
nielskaspers wants to merge 3 commits intomodelcontextprotocol:mainfrom
Open
Add Vitest tests for Everything Server#3236nielskaspers wants to merge 3 commits intomodelcontextprotocol:mainfrom
nielskaspers wants to merge 3 commits intomodelcontextprotocol:mainfrom
Conversation
Adds comprehensive test coverage for the Everything Server including: Tools (10 tools tested): - echo: message echoing with validation - get-sum: number addition with edge cases - get-env: environment variable retrieval - get-tiny-image: image content blocks - get-structured-content: weather data for all cities - get-annotated-message: priority/audience annotations - trigger-long-running-operation: progress notifications - get-resource-links: dynamic resource link generation - get-resource-reference: text/blob resource validation Prompts (4 prompts tested): - simple-prompt: no-argument prompt - args-prompt: city/state arguments - completable-prompt: department/name completions - resource-prompt: embedded resource references Resources: - templates.ts: URI generation, text/blob resources - session.ts: session-scoped resource registration Test infrastructure: - vitest.config.ts with v8 coverage - Mock server helper for capturing registered handlers - 81 tests, all passing Closes modelcontextprotocol#2925 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Complete test coverage for all 16 Everything Server tools: New tests added: - toggle-simulated-logging: start/stop logging toggle, session handling - toggle-subscriber-updates: start/stop updates toggle, session handling - trigger-sampling-request: capability check, sampling request/response - trigger-elicitation-request: capability check, accept/decline/cancel actions - get-roots-list: capability check, registration - gzip-file-as-resource: compression, resource/resourceLink output types Test count: 102 tests (was 81) Coverage: 64.73% overall, 90.93% tools (was 34%, 40%) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Additional test coverage: - server/index.ts: createServer factory, cleanup function (91% coverage) - tools/index.ts: registerTools, registerConditionalTools (100% coverage) - prompts/index.ts: registerPrompts (100% coverage) - resources/index.ts: registerResources, readInstructions (88% coverage) - resources/files.ts: registerFileResources (54% coverage) - resources/subscriptions.ts: handlers, begin/stop updates (47% coverage) Test count: 124 tests (was 102) Coverage: 71.35% overall (was 64.73%) - Tools: 93.12% - Prompts: 90.53% - Server: 62.93% - Resources: 65.44% Note: Transport files (stdio.ts, sse.ts, streamableHttp.ts) are entry points that start Express servers. These require integration tests rather than unit tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive Vitest test coverage for the Everything Server, addressing #2925.
Coverage by Component
Tools (16/16 tested)
All tools at 100% except:
get-roots-list(35%) - capability-gated branchesgzip-file-as-resource(84%) - network error branchesNot Unit Tested
Transport files (
stdio.ts,sse.ts,streamableHttp.ts) are executable entry points that start Express servers. These require integration tests rather than unit tests.Test Files
Test Plan